{include file="public/header"}
<div class="page-content">
    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
        <div class="widget am-cf" style=" height: 500px;">
            <a href="{:url('Bclass/listbclass')}">
                <i title="返回" class="iconfont"
                   style="font-size:2.5rem;float: left">&#xe697;</i></a>
            <form class="stdform" action="{:url('Bclass/doadd')}" method="post" enctype="multipart/form-data">
                <div class="widget-body">
                    <fieldset>
                        <div class="widget-head am-cf">
                            <div class="widget-title am-cf">添加一级分类</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="am-u-sm-3 am-u-lg-2 layui-form-label">分类名称 </label>
                            <div class="am-u-sm-9">
                                <input type="text" class="layui-input layui-input-inline" name="bname"
                                       placeholder="分类名称" required>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="am-u-sm-3 am-u-lg-2 layui-form-label">排序编号</label>
                            <div class="am-u-sm-9 ">
                               <input type="text" name="orderno" class="layui-input layui-input-inline" placeholder="排序编号" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="am-u-sm-3 am-u-lg-2 layui-form-label">分类图标</label>
                            <div class="am-u-sm-9 ">
                                    <input type="file"name="file"
                                           class="upload-file"/> <br>
<!--                                <button type="button" onclick="upLoad()"-->
<!--                                        class="layui-btn">上传-->
<!--                                </button>-->

                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="am-u-sm-3 am-u-lg-2 layui-form-label">描述</label>
                            <div class="am-u-sm-9 ">
                                  <textarea cols="80" rows="5" name="describe" style="resize:none;width:530px;"
                                            class="layui-textarea" placeholder="分类描述"></textarea>
                            </div>
                        </div>

                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                            <button type="submit" class="j-submit am-btn am-btn-secondary">提交</button>
                            <button type="reset" class="am-btn am-btn-default">重置</button>
                                </div>
                            </div>
                    </fieldset>
                </div>
            </form>
                </div>
            </div>
        </div>

<script>
    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element;

    });
    layui.use(['element','layer'], function(){
        var element = element;});

    function upLoad() {
        var from = new FormData();
        var img=$('#img').get(0).files[0];
        from.append("file", img);
        $.ajax({
            type: 'post',
            url:"{:url('picupload/picupload')}",
            data:from,
            dataType:'json',
            contentType: false,
            processData: false,
            success: function (data) {
                if(data.status==1){
                    alert(data.message);
                }else{
                    alert(data.message);
                }
            }
        });
        return false;


            // window.location.href="{:url('picupload/picupload')}";
    }
</script>

</body>
</html>

